<template>
	<view class="contenting">
		<Search></Search>
		<Preference :preferdata='preferdata'></Preference>
		<Title></Title>
		<Delicacy></Delicacy>
		<Takeout></Takeout>
	</view>
</template>

<script>
	// 引进子组件
	import Search from './components/search.vue'
	import Preference from './components/preference.vue'
	import Title from './components/title.vue'
	import Delicacy from './components/delicacy.vue'
	import Takeout from './components/takeout.vue'
	// 引入接口
	import {listing} from '../../api/api.js'
	// 引入请求地址
	import {getPreferurl} from '../../api/request.js'
	export default {
		components:{
			Search,
			Preference,
			Title,
			Takeout,
			Delicacy
		},
		data() {
			return {
				preferdata:[],//为你优选
				title: 'Hello'
			}
		},
		mounted(){
			this.preference()
		},
		methods: {
			// 为你优选
			preference(){
				listing(getPreferurl).then((res)=>{
					this.preferdata = res[1].data
				}).catch((res)=>{
					console.log(res)
				})
			}
		}
	}
</script>

<style scoped>
	.contenting{
		margin: 0 15upx;
	}
</style>
